<?php

use yii\helpers\Html;
use yii\grid\GridView;
use app\models\BidRcd;

/* @var $this yii\web\View */
/* @var $searchModel app\models\BidRcdSearch */
/* @var $bidRcdDataProvider yii\data\ActiveDataProvider */

$this->title ='出价记录';
$this->params['breadcrumbs'][] = ['label' => '竞拍', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <?= GridView::widget([
        'dataProvider' => $bidRcdDataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'bidrcdid',
            'name',
            [
                'attribute'=>'img',
                'format' => 'raw',
                'value'=>function($model){
                    return '<div class="thumbnail">'
                        .Html::img(\app\models\UploadForm::SHOW_DIR.$model->img,['width'=>'300px','height'=>'100px'])
                        .'</div>';
                },
                'filter'=>false,
            ],
            [
                'label'=>'地区',
                'value'=>function($model){
                    /* @var $model app\models\BidRcd */
                    return $model->province.$model->city.$model->county;
                }
            ],
            [
                'attribute' => 'state',
                'value'=>function($model){
                    /* @var $model app\models\BidRcd */
                    return BidRcd::dropdown('state',$model->state);
                },
                'filter'=>BidRcd::dropdown('state'),
                'filterInputOptions'=>['prompt'=>'全部','class'=>'form-control'],
                'headerOptions'=>['width'=>'10%'],
            ],
            'price',
            [
                'attribute' => 'created_at',
                'format' => ['date', 'php:Y-m-d']
            ],
            [
                'attribute' => 'updated_at',
                'format' => ['date', 'php:Y-m-d']
            ],
        ],
    ]); ?>
</div>